package com.huixiaodian.baselibrary.interceptor;

import android.content.Context;
import android.util.Log;

import androidx.annotation.NonNull;


import java.io.IOException;
import java.util.List;

import okhttp3.Interceptor;
import okhttp3.Response;

public class ReceivedCookieInterceptor implements Interceptor {

    private Context context;

    public ReceivedCookieInterceptor(Context context) {
        super();
        this.context = context;
    }


    @NonNull
    @Override
    public Response intercept(Chain chain) throws IOException {
        Response originalResponse = chain.proceed(chain.request());
        List<String> cookies = originalResponse.headers("Set-Cookie");
        if (!cookies.isEmpty()) {
            for(String string : cookies){
                Log.i("999999999999", string);
            }
        }
        return originalResponse;
    }
}
